﻿using System;
using System.Collections.Generic;
using System.Text;
using XoLib.Data;
using System.Reflection;

namespace XoLib.Manager
{
    /*
    /// <summary>
    /// Manager of class
    /// </summary>
    /// <example> new ClassManager.ProcessClass( "Truc.Pol", 1); </example>/// 
    public class ClassManager : Singleton<ClassManager>
    {

        static public void Init(Type[] ClassTypes)
        {
            foreach (Type pType in ClassTypes)
            {
                if (typeof(IRegistrator).IsAssignableFrom(pType))
                {

                    object[] paramList = new object[1] { ClassTypes };
                    pType.InvokeMember("RegisterClass", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, paramList);

                   var ff = pType.GetProperty("bar");
                    
                        //return default(U);
                }

               // RegisterClass<U>(pType);
            }
        }

        /// <summary>
        /// <para>
        /// <param name="Name">string</param>
        /// <param name="Code">ushort</param>
        /// <param name="data">IData</param>
        /// </para>
        ///  new ClassManager.ProcessClass( "Truc.Pol", 1);
        /// </summary>
        public bool ProcessClass<T>(string Name, ushort Code, ref T data)
        {
            /*
            IExeClass packetTemplate;

            if (!ClassRegistrator.Instance.TryGetValue(Name, Code, out packetTemplate))
                return;

            if (packetTemplate.Initialize(ref data))
            {
                packetTemplate.Handle(ref data);
            }*/

    /*        return false;
        }
    }*/
    
}
